package com.medusa.aps.business.modules.security.controller;

import com.medusa.aps.business.common.model.resp.Result;
import com.medusa.aps.business.model.pagination.Page;
import com.medusa.aps.business.modules.security.model.input.MenuQueryPara;
import com.medusa.aps.business.modules.security.mp.entity.Menu;
import com.medusa.aps.business.modules.security.mp.service.IMenuService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 菜单信息控制层
 *
 * @author: yuxh
 * @order 3
 **/
@Validated
@RestController
@RequestMapping("/system/menu")
@Tag(name = "系统管理-菜单表", description = "系统管理-菜单表")
public class MenuController {

    @Resource
    private IMenuService menuService;

    /**
     * 分页查询菜单
     *
     * @param menuQueryPara 菜单查询参数
     * @return 菜单分页列表
     */
    @GetMapping("/pageMenu")
    @Operation(summary = "分页查询菜单")
    public Result<Page<Menu>> pageMenu(MenuQueryPara menuQueryPara) {
        return Result.ok(menuService.pageMenu(menuQueryPara));

    }

    /**
     * 获取菜单树
     */
    @GetMapping(value = "/treeMenu")
    @Operation(summary = "获取菜单树")
    public Result<List<Menu>> treeMenu() {
        return Result.ok(menuService.treeMenu());
    }

}
